#ifndef MEASURE_SIZE_TRACKER_INTERSECTS_VISITOR_H_
#define MEASURE_SIZE_TRACKER_INTERSECTS_VISITOR_H_

#if defined(_MSC_VER)
#pragma once
#endif

#include "geometry_elements.h"
#include "boost\variant\static_visitor.hpp"

class intersects_visitor : public boost::static_visitor<bool>
{
public:

  intersects_visitor(const box_2& box)
    : box_(box)
  {
  }

  ~intersects_visitor(void)
  {
  }

public:

  bool operator()(const point_2& point) const
  {
    return point.intersects(box_);
  }

  bool operator()(const segment_2& segment) const
  {
    return segment.intersects(box_);
  }

  bool operator()(const box_2& box) const
  {
    return box.intersects(box_);
  }

  bool operator()(const angle_box_2& angle_box) const
  {
    return angle_box.intersects(box_);
  }

  bool operator()(const ring_2& ring) const
  {
    return ring.intersects(box_);
  }

  bool operator()(const arc_2& arc) const
  {
    return arc.intersects(box_);
  }

  bool operator()(const annulus_2& annulus) const
  {
    return annulus.intersects(box_);
  }

  bool operator()(const annulus_arc_2& annulus_sector) const
  {
    return annulus_sector.intersects(box_);
  }

  bool operator()(const polygon_2& polygon) const
  {
    return polygon.intersects(box_);
  }

private:
  const box_2& box_;
};

#endif // MEASURE_SIZE_TRACKER_INTERSECTS_VISITOR_H_